package com.dyna.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dyna.core.utils.SecurityUtil;
import com.dyna.foundation.domain.entity.SysNotifyMessage;
import com.dyna.mapper.SysNoticeMessageMapper;
import com.dyna.service.SysNotifyMessageService;
import org.springframework.stereotype.Service;

@Service
public class SysNotifyMessageServiceImpl
        extends ServiceImpl<SysNoticeMessageMapper, SysNotifyMessage>
        implements SysNotifyMessageService
{

    @Override
    public Long getUnreadNotifyMessageCount() {
        LambdaQueryWrapper<SysNotifyMessage> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(SysNotifyMessage::getUserId, SecurityUtil.getUserId());
        queryWrapper.eq(SysNotifyMessage::getReadStatus, false);
        return baseMapper.selectCount(queryWrapper);
    }

}